local blaze = require "blaze"
local base = blaze.timer

local cache = {} -- <id, true>

local M = {}

function M.start(handler, interval, loop, unscale)
    local timer_id = base.start(handler, interval, loop, unscale)
    cache[timer_id] = true
    return timer_id
end

function M.stop(timer_id)
    base.stop(timer_id)
    cache[timer_id] = nil
end

function M.release()
    for timer_id, _ in pairs(cache) do
        base.stop(timer_id)
    end
end

return M